#!/usr/bin/env python

import sys
import os

def main():
  start = int(sys.argv[1])
  end = int(sys.argv[2])
  mid = get_mid(start, end)
  while mid <= max:
    print "checking", str(mid)
    if is_broken_at_rev(mid):
      if mid is end:
        break
      end = mid
      mid = get_mid(start, end)
    else:
      start = mid + 1
      mid = get_mid(start, end)
  print "broken at", str(mid)

def get_mid(a, b):
  return a + ((b - a)/2)

def is_broken_at_rev(rev):
  testApp = "testChessBoard.py"
  get_revision(rev)
  return os.system("./" + testApp) != 0

def get_revision(revision):
  os.system("svn update -r" + str(revision))
  return


if __name__ == '__main__':
  main()
